import 'dart:ui';

import 'package:flutter/material.dart';
import 'res/listData.dart';

class ExpandedLayout extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("有点f麻烦"),
        ),
        body: HomeContent(),
      ),
    );
  }
}

class HomeContent extends StatelessWidget {
  Widget setData(context, index) {
    return ListTile(
      leading: Image.network(mListData[index]["imageUrl"]),
      title: Text(mListData[index]["title"]),
      subtitle: Text(mListData[index]["author"]),
    );
  }

  // Widget setData() {
  //   GridTile();
  // }

  Widget getData(context, index) {
    return Container(
      child: Column(
        children: <Widget>[
          Image.network(mListData[index]["imageUrl"]),
          SizedBox(
            height: 10,
          ),
          Text(
            mListData[index]["title"],
            textAlign: TextAlign.center,
          )
        ],
      ),
      decoration: BoxDecoration(
          border: Border.all(color: Colors.yellow, width: 1),
          borderRadius: BorderRadius.all(Radius.circular(8))),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.end,
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        IconContainer(
          Icons.home,
          height: 100.0,
          width: 100.0,
          backgroundColor: Colors.blue,
          colorkk: Colors.yellow,
        ),
        Expanded(
            flex: 1,
            child: IconContainer(
              Icons.home,
              height: 100.0,
              width: 100.0,
              backgroundColor: Colors.green,
              colorkk: Colors.yellow,
            )),
      ],
    );
  }
}

class IconContainer extends StatelessWidget {
  IconData icon;
  double height;
  double width;
  Color backgroundColor;
  double size = 32.0;
  Color colorkk;
  IconContainer(this.icon,
      {this.height, this.width, this.backgroundColor, this.colorkk});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      height: this.height,
      width: this.width,
      color: this.backgroundColor,
      child: Center(
        child: Icon(
          this.icon,
          size: this.size,
          color: this.colorkk,
        ),
      ),
    );
  }
}
